<%@page import="net.groupme.gui.constants.VIEW_VOCABULARY"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>   

<!-- Java Script Stuff -->
<script type='text/javascript'><!--
/*
function logout() {
  DWRUserManager.logout(logoutFinished);
}
  
function logoutFinished(success) {
   	var wholeLoginForm = document.getElementById("userloginform");
   	wholeLoginForm.innerHTML = "<form name='login' action='<%= request.getContextPath() + "/" + VIEW_VOCABULARY.ACTION_LOGIN %>' method='get'> " +
   								"username: <input type='text' name='<%= VIEW_VOCABULARY.PARAMETER_USERNAME %>'/> " +
   								"password: <input type='password' name='<%= VIEW_VOCABULARY.PARAMETER_PASSWORD %>'/> " + 
   								"<input type='submit' value='login'/> " +
   								"</form>";
   }
 */
 //-->
</script>
<div id="userloginform" style="font-size: 0.8em;">
<c:choose>
<c:when test="${userManager.loggedIn}">
	 <p>logged in as <c:out value="${userManager.user.userName}"/></p>
     <a href="<%= VIEW_VOCABULARY.ACTION_LOGOUT %>" title="logout and go to welcome page">logout</a>
</c:when>
<c:otherwise>
<form name="login" action="<%= VIEW_VOCABULARY.GROUPME_BASE_URL +  VIEW_VOCABULARY.ACTION_LOGIN %>" method="post">
<table>
<tr>
	<td>username: </td>
	<td><input type="text" name="<%= VIEW_VOCABULARY.PARAMETER_USERNAME %>" value="<c:out value='${username}'/>"/></td>
</tr>
<tr>
	<td>password:</td> <td><input type="password" name="<%= VIEW_VOCABULARY.PARAMETER_PASSWORD %>"/> </td>
</tr>
<tr>
	<td style="text-align: right;"> <input type="checkbox" name="<%= VIEW_VOCABULARY.PARAMETER_KEEP_PERMANENT_LOGGED_IN %>"/></td>
	<td><i>remember me</i></td>
</tr>
<tr>
	<td><input type="hidden" name="<%= VIEW_VOCABULARY.PARAMETER_REDIRECT %>" value="${redirect}"/></td>
	<td><input type="submit" value="login"/> </td>
</tr>
</table>
</form>
<span id="loginmessage">
	<font color="red"><c:out value="${loginstatus}"/></font>
</span>
</c:otherwise>
</c:choose>
</div>